﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script src="../Script/easyui/jquery.min.js"></script>
    <script src="../Script/easyui/jquery.easyui.min.js"></script>
    <link href="../Script/easyui/themes/default/easyui.css" rel="stylesheet" />    
    <link href="../Script/easyui/themes/icon.css" rel="stylesheet" />
    <script src="../Script/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript">
        var json = [{
            "id": 1,
            "text": "物理防治",
            "state": "closed",
            "children": [{
                "id": 11,
                "text": "测报灯"
            }, {
                "id": 12,
                "text": "杀虫灯"
            }, {
                "id": 12,
                "text": "粘虫板"
            }, {
                "id": 12,
                "text": "防虫网"
            }]
        }, {
            "id": 2,
            "text": "化学防治",
            "state": "closed",
            "children": [{
                "id": 11,
                "text": "聚脂类"
            }, {
                "id": 12,
                "text": "生物类"
            }, {
                "id": 12,
                "text": "其它"
            }]
        },
        {
            "id": 2,
            "text": "生物防治",
            "state": "closed",
            "children": [{
                "id": 11,
                "text": "真菌"
            }, {
                "id": 12,
                "text": "蜂类"
            }, {
                "id": 12,
                "text": "细菌"
            }, {
                "id": 12,
                "text": "病毒"
            }, {
                "id": 12,
                "text": "鸟类"
            }]
        },
        {
            "id": 2,
            "text": "飞机防治",
            "state": "closed"

        },
        {
            "id": 2,
            "text": "其他",
            "state": "closed",
            "children": [{
                "id": 11,
                "text": "油料作物"
            }, {
                "id": 12,
                "text": "糖料作物"
            }, {
                "id": 12,
                "text": "纤维作物"
            }]
        }];
        var json2 = [{
            "id": 1,
            "text": "虫害",
            "state": "closed",
            "children": [{
                "id": 11,
                "text": "松瘿小卷蛾"
            }, {
                "id": 12,
                "text": "微红梢斑螟"
            }, {
                "id": 12,
                "text": "松梢螟"
            }, {
                "id": 12,
                "text": "春尺蠖"
            }, {
                "id": 12,
                "text": "落叶松尺蛾"
            }, {
                "id": 12,
                "text": "落叶松毛虫"
            }, {
                "id": 12,
                "text": "黄褐天幕毛虫"
            }, {
                "id": 12,
                "text": "银杏大蚕蛾"
            }]
        }, {
            "id": 2,
            "text": "病害",
            "state": "closed",
            "children": [{
                "id": 11,
                "text": "松落针病"
            }, {
                "id": 12,
                "text": "松针红斑病"
            }, {
                "id": 12,
                "text": "五针松疱锈病"
            }, {
                "id": 12,
                "text": "落叶松落叶病"
            }, {
                "id": 12,
                "text": "杨树溃疡病"
            }, {
                "id": 12,
                "text": "杨树烂皮病"
            }]
        },
       {
           "id": 2,
           "text": "鼠害",
           "state": "closed",
           "children": [{
               "id": 11,
               "text": "瓜类"
           }, {
               "id": 12,
               "text": "浆果类"
           }, {
               "id": 12,
               "text": "柑橘类"
           }]
       },
       {
           "id": 2,
           "text": "草害",
           "state": "closed",
           "children": [{
               "id": 11,
               "text": "乔木类",
               "children": [{
                   "id": 11,
                   "text": "雪松"
               }, {
                   "id": 12,
                   "text": "红松"
               }, {
                   "id": 12,
                   "text": "黑松"
               }]
           }, {
               "id": 12,
               "text": "灌木类"
           }, {
               "id": 12,
               "text": "藤本类"
           }, {
               "id": 12,
               "text": "竹类"
           }, {
               "id": 12,
               "text": "草坪"
           }]
       },
       {
           "id": 2,
           "text": "其他",
           "state": "closed",
           "children": [{
               "id": 11,
               "text": "油料作物"
           }, {
               "id": 12,
               "text": "糖料作物"
           }, {
               "id": 12,
               "text": "纤维作物"
           }]
       }];
        var json3 = {
            "total": 3,
            "rows": [{
                "userid": "1",
                "user": "松瘿小卷蛾",
                "user1": "杀虫灯",
                "user2": "",
                "user3": "已审核",
                "user4": "havarew@163.com",
                "user5": "济南明发",
                "user6": "0531-89653245",
                "user7": "济南小区232路"
            },
                {
                    "userid": "2",
                    "user": "微红梢斑螟",
                    "user1": "杀虫灯",
                    "user2": "",
                    "user3": "已审核",
                    "user4": "havarew@163.com",
                    "user5": "济南明发",
                    "user6": "0531-89653245",
                    "user7": "济南小区232路",
                },
                {
                    "userid": "3",
                    "user": "落叶松尺蛾",
                    "user1": "杀虫灯",
                    "user2": "",
                    "user3": "未审核",
                    "user4": "havarew@163.com",
                    "user5": "济南明发",
                    "user6": "0531-89653245",
                    "user7": "济南小区232路",
                }]
        };

        
        $(function () {
            InitGird();
            InitSearch();
        });
        //初始化表格
        function InitGird() {
            $('#tt').tree({
                lines: 'true',
                title: '防治技术',
                checkbox:'true',
                onlyLeafCheck:'true'
            });

            $('#tt').tree("loadData", json);
            $('#tt1').tree({
                lines: 'true',
                title: '有害生物',
                checkbox: 'true',
                onlyLeafCheck: 'true'
            });

            $('#tt1').tree("loadData", json2);
            $('#tab_list').datagrid({
                title: '防治方法列表', //表格标题
                //url: 'content.json', //请求数据的页面
                sortName: 'user', //排序字段
                idField: 'user', //标识字段,主键
                iconCls: '', //标题左边的图标
                width: '100%', //宽度
                //height: $(parent.document).find("#mainPanle").height() - 35 > 0 ? $(parent.document).find("#mainPanle").height() - 35 : 500, //高度
                nowrap: false, //是否换行，True 就会把数据显示在一行里
                striped: true, //True 奇偶行使用不同背景色
                collapsible: false, //可折叠
                sortOrder: 'desc', //排序类型
                remoteSort: true, //定义是否从服务器给数据排序
                fitColumns: true,
                //frozenColumns: [[//冻结的列，不会随横向滚动轴移动

                //]],
                columns: [[
                    { field: 'ckb', checkbox: true },
	                { title: '防治技术', field: 'user', width: 150, sortable: true },
                    { title: '有害生物', field: 'user1', width: 150 },
                    //{ title: '参数', field: 'user2', width: 180 },
                    //{ title: '状态', field: 'user3', width: 120 },                    
                    {
                        title: '操作', field: 'userid', width: 80, formatter: function (value, row, index) {
                            return '<a style="color:red" href="javascript:" onclick="EditData(' + value + ');$(this).parent().click();return false;">修改</a>';
                        }
                    }
                ]],
                toolbar: "#Div2",
                queryParams: { "action": "query" },
                pagination: true, //是否开启分页
                pageNumber: 1, //默认索引页
                pageSize: 20, //默认一页数据条数
                rownumbers: true //行号
            });
            $('#tab_list').datagrid("loadData", json3);       

        }
        //初始化搜索框
        function InitSearch() {
            $("#ipt_search").searchbox({
                width: 200,
                //iconCls: 'icon-save',
                searcher: function (val, name) {
                    $('#tab_list').datagrid('options').queryParams.search_type = name;
                    $('#tab_list').datagrid('options').queryParams.search_value = val;
                    $('#tab_list').datagrid('reload');
                },
                prompt: '请输入查询信息'
            });
        }

       
    </script>
</head>
<body>
    <table>
        <tr>
            <td><div id="p" class="easyui-panel" title="防治技术"     
        style="width:400px;height:300px;padding:10px;background:#fafafa; "   
        data-options="iconCls:'icon-cut',closable:false">   
   <ul id="tt"></ul> 
</div></td>
            <td><div id="Div1" class="easyui-panel" title="有害生物"     
        style="width:400px;height:300px;padding:10px;background:#fafafa; "   
        data-options="iconCls:'icon-help',closable:false">   
   <ul id="tt1"></ul> 
</div></td>
        </tr>
    </table>
    
        <div id="tab_toolbar" style="padding: 4px;">
            <table cellpadding="0" cellspacing="0" style="width: 100%">
                <tr>

                    <td style="padding-left: 2px">


                        <a href="#" onclick="OpenWin();" id="a_add"
                            class="easyui-linkbutton" iconcls="icon-add">添加</a>

                        <a href="#" onclick="DelData(0);return false;" id="a_del" class="easyui-linkbutton" iconcls="icon-cancel">删除</a>

                    </td>                  
                </tr>
            </table>

        </div>
     <table id="tab_list">
        </table>
        <div id="Div2" style="padding: 4px;">
            <table cellpadding="0" cellspacing="0" style="width: 100%">
                <tr>

                    <td style="padding-left: 2px">


                        <a href="#" onclick="OpenWin();" id="a1"
                            class="easyui-linkbutton" iconcls="icon-add">添加</a>

                        <a href="#" onclick="DelData(0);return false;" id="a2" class="easyui-linkbutton" iconcls="icon-cancel">删除</a>

                    </td>
                   <!-- <td style="text-align: right; padding-right: 15px">
                        <input id="ipt_search" menu="#search_menu" />
                        <div id="search_menu" style="width: 120px">
                            <div name="usernum">
                                用户名
                            </div>
                            <div name="username">
                                姓 名
                            </div>
                        </div>
                    </td>-->
                </tr>
            </table>

        </div>

</body>
</html>
